package top.archiesean.authorize.support.core;

import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import top.archiesean.authorize.support.handler.FormAuthenticationFailureHandler;

/**
 * @author ArchieSean
 * @description 基于授权码模式，统一认证登录
 * @date 2024-02-05 20:52
 */

public final class FormIdentityLoginConfigurer extends AbstractHttpConfigurer<FormIdentityLoginConfigurer, HttpSecurity> {
    @Override
    public void init(HttpSecurity http) throws Exception {
        http.formLogin()
                .loginPage("/token/login")
                .loginProcessingUrl("/token/auth")
                .permitAll()
                .failureHandler(new FormAuthenticationFailureHandler());
        ;
    }
}
